package com.hedy.order.controller;



import com.hedy.order.feign.UserFeignClient;
import com.hedy.order.service.OrderService;
import dto.OrderDTO;
import dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import response.OrderResponse;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping(value = "order")
public class OrderController {

    //feign客户端
    @Qualifier("com.hedy.order.feign.UserFeignClient")
    @Autowired
    UserFeignClient userFeignClient;

    @Autowired
    OrderService orderService;

    @GetMapping(value = "getOrders")
    public OrderResponse getOrders(@RequestParam(name = "uid") Integer uid) {
        return  orderService.getOrders(uid);
    }

    @GetMapping(value = "testRibbon")
    public String ribbon01(){
        for (int i=0;i<10;i++){
            UserDTO user = userFeignClient.getUserInfo(i);
        }
        return "test ribbon";
    }

}
